﻿@using ZX.Tools
@using ZX.Model
@using ZX.BLL
@model My_Work
@{
    Sys_UserModel user = ViewBag.User;
    List<Sys_User> userList = ViewBag.UserList ?? new List<Sys_User>();
}
<link type="text/css" rel="stylesheet" href="/Static/styles/bootstrap.min.css">
<link type="text/css" rel="stylesheet" href="~/Static/css/theme/default/style.css" />
<link href="~/Static/js/layui/css/layui.css" rel="stylesheet" />
<script src="/Static/js/jquery/jquery-1.11.1.min.js"></script>
<script src="~/Static/js/layui/layui.js"></script>
<div class='row page-content'>
    <div class='panel'>
        <div class='panel-body'>
            <form action="/My_Work/SaveApproval" method="post" class="form" id="formMy_Work">
                <input type="hidden" name="Id" value="@Model.Id" />
                <input type="hidden" name="status" value="@ApplyStatus.驳回.ToInt()" />
                <input type="hidden" name="deptId" value="@user.Fk_DeptId" />
                <table class='table table-bordered' style="border: 1px solid #ddd;">
                    <tr>
                        <th class="text-center w-120px">姓名</th>
                        <td>
                            @user.RealName
                        </td>
                        <th class='text-center w-50px'>部门</th>
                        <td>
                            @user.DeptName
                        </td>
                        <th class='text-center w-50px'>职位</th>
                        <td>
                            @user.PositionName
                        </td>
                    </tr>
                    <tr>
                        <th class="text-center w-120px">事由</th>
                        <td colspan="5">
                            @Model.ADesc
                        </td>
                    </tr>
                    <tr>
                        <th class="text-center w-120px">时间</th>
                        <td colspan="4">
                            @{
                                DateTime dt = Convert.ToDateTime(Model.StartTime);
                                int month = dt.Month;
                                int day = dt.Day;
                                string hh = dt.Hour < 10 ? "0" + dt.Hour : dt.Hour + "";

                                DateTime endDt = Convert.ToDateTime(Model.EndTime);
                                int endMonth = endDt.Month;
                                int endDay = endDt.Day;
                                string endhh = endDt.Hour < 10 ? "0" + endDt.Hour : endDt.Hour + "";
                            }

                            @(month + "月" + day + "日" + hh + "时" + "----" + endMonth + "月" + endDay + "日" + endhh + "时")
                        </td>
                        <td>
                            <span style="line-height:2;" id="iday">@("共 " + Model.ATotalLength + " 天")</span>
                        </td>
                    </tr>
                    <tr>
                        <th class="text-center w-120px">部门负责人签字</th>
                        <td colspan="5">

                            @{
                                int approvalUserCount = userList.Count;

                                string userSign0 = "";
                                string userSign1 = "";


                                try
                                {
                                    userSign0 = userList[0].USgin;
                                }
                                catch { }

                                try
                                {
                                    userSign1 = userList[1].USgin;
                                }
                                catch { }

                            }

                            <div>
                                @if (userSign1.IsNotNullOrEmpty())
                                {
                                    <img src="@userSign1" style="width:200px;height:50px;margin-left:7px;" />
                                }
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <th class="text-center w-120px" style="height:80px;">副总经理审批</th>
                        <td colspan="5">
                            <div>
                                @if (userSign0.IsNotNullOrEmpty())
                                {
                                    <img src="@userSign0" style="width:200px;height:50px;margin-left:7px;" />
                                }
                            </div>
                        </td>
                    </tr>
                </table>
            </form>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(function () {
        onprint();
    });
    function printHtml(html) {
        var bodyHtml = html;
        document.body.innerHTML = html;
        window.print();
        document.body.innerHTML = bodyHtml;
    }
    function onprint() {
        var html = $(".panel-body").html();
        printHtml(html);
    }
</script>